package com.workcell.workdata.xthings.constant;


import lombok.AllArgsConstructor;
import lombok.Getter;

public interface UpperComputerDataStatusEnum {

	@Getter
	@AllArgsConstructor
	enum NormalStatusEnum {
		NORMAL("0","正常"),
		ABNORMAL("1","异常"),
		OVER("","");
		private String code;
		private String msg;

		public static NormalStatusEnum getByCode(String code) {
			for (NormalStatusEnum normalStatusEnum : values()) {
				if (normalStatusEnum.getCode().equals(code)) {
					//获取指定的枚举
					return normalStatusEnum;
				}
			}
			return NormalStatusEnum.OVER;
		}
	}

	@Getter
	@AllArgsConstructor
	enum OpenStatusEnum{
		ON("0","OFF"),
		OFF("1","ON"),
		OVER("","");
		private String code;
		private String msg;

		public static OpenStatusEnum getByCode(String code) {
			for (OpenStatusEnum openStatusEnum : values()) {
				if (openStatusEnum.getCode().equals(code)) {
					//获取指定的枚举
					return openStatusEnum;
				}
			}
			return OpenStatusEnum.OVER;
		}
	}

	@Getter
	@AllArgsConstructor
	enum RunStatusEnum {
		NORMAL("0","运行中"),
		ABNORMAL("1","停止中"),
		OVER("","");
		private String code;
		private String msg;

		public static RunStatusEnum getByCode(String code) {
			for (RunStatusEnum runStatusEnum : values()) {
				if (runStatusEnum.getCode().equals(code)) {
					//获取指定的枚举
					return runStatusEnum;
				}
			}
			return RunStatusEnum.OVER;
		}
	}
}
